<!DOCTYPE HTML>
<html>

<head>
<?php
$file_handle = fopen("header.txt", "r");

while (!feof($file_handle)) {
	$line = fgets($file_handle);
	echo $line;
}

fclose($file_handle);
?>

<script type="text/javascript">
  			var _gaq = _gaq || [];
  			_gaq.push(['_setAccount', 'UA-35894224-1']);
  			_gaq.push(['_trackPageview']);

  			(function() {
    			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  			})();
		</script>
</head>

<body>
	<div id="main">
		<div id="header">
			<div id="logo">
				<div id="logo_text">
					<?php
					$file_handle = fopen("logo.txt", "r");

					while (!feof($file_handle)) {
   				$line = fgets($file_handle);
   				echo $line;
			}

			fclose($file_handle);
			?>
				</div>
			</div>
			<div id="menubar">
				<ul id="menu">
					<!-- put class="selected" in the li tag for the selected page - to highlight which page you're on -->
					<li class="selected"><a href="index.php">Home</a></li>
					<li><a href="bio.php">Bio</a></li>
					<li><a href="curriculum.php">Curriculum</a></li>
					<li><a href="experience.php">Experience</a></li>
					<li><a href="teaching.php">Teaching</a></li>
					<li><a href="publications.php">Publications</a></li>
					<li><a href="contact.php">Contact</a></li>
				</ul>
			</div>
		</div>
		<div id="site_content">
			<div class="sidebar">
				<!-- insert your sidebar items here -->
				<?php
				$file_handle = fopen("latestNews.txt", "r");
					
				while (!feof($file_handle)) {
   				$line = fgets($file_handle);
   				echo $line;
			}

			fclose($file_handle);
			?>
			</div>




			<div id="content">
				<!-- insert the page content here -->
				<h1 align="center" style="padding-top: 100px;">Hello there, I am
					Hernani Costa.</h1>
				<div class="container">
					<div class="fake_img">
						<img src="images/me/bio.jpg" alt="Hernani Costa" height="128"
							width="128">
					</div>
					<div class="fake_img">
						<img src="images/me/bio.jpg" alt="Hernani Costa" height="128"
							width="128">
					</div>
					<div class="fake_img">
						<img src="images/me/bio.jpg" alt="Hernani Costa" height="128"
							width="128">
					</div>
				</div>
				<h1 align="center">Welcome to my home page!</h1>
				<!-- <h2>Expect considerable changes during the next months.</h2> -->
				<!---
<h1>Welcome to my homepage</h1>

<p>This standards compliant, simple, fixed width website template is
released as an 'open source' design (under a <a
	href="http://creativecommons.org/licenses/by/3.0">Creative Commons
Attribution 3.0 Licence</a>), which means that you are free to download and
use it for anything you want (including modifying and amending it). All
I ask is that you leave the 'design from HTML5webtemplates.co.uk' link
in the footer of the template, but other than that...</p>
<p>This template is written entirely in <strong>HTML5</strong> and <strong>CSS</strong>,
and can be validated using the links in the footer.</p>
<p>You can view more free HTML5 web templates <a
	href="http://www.html5webtemplates.co.uk">here</a>.</p>
<p>This template is a fully functional 5 page website, with an <a
	href="examples.html">examples</a> page that gives examples of all the
styles available with this design.</p>
<h2>Browser Compatibility</h2>
<p>This template has been tested in the following browsers:</p>
<ul>
	<li>Internet Explorer 8</li>
	<li>FireFox 3</li>
	<li>Google Chrome 13</li>
</ul>

 -->




				<!-- At present, Ana Margarida is a PhD candidate in Science and Technology Education at UTAD, and a research at Centro de I de Formadores (CIDTFF) -->


				<!-- In the beginning of 2013, Hugo started an experience in the industry, more precisely at Spotter, a leading company on textual analysis to measure risks and opinions.  -->
				<!-- There, he applied some of the knowledge acquired in the previous years, as he worked on the evaluation and development of Natural Language Processing tools. -->



			</div>
		</div>




		<div id="content_footer"></div>
		<div id="footer">
			<div class="padding">
				<?php
					
				if (file_exists("count_file.txt")){
				$file = fopen("count_file.txt", "r");
				$n = fread($file, filesize("count_file.txt"));
				$n=$n+1;
				echo "Number of times this page has been accessed: ".$n;
				fclose($file);

				/*echo '<a href="http://www.hitwebcounter.com/" target="_blank">
					<img src="http://hitwebcounter.com/counter/counter.php?page=4593446&style=0025&nbdigits=5&type=page&initCount=0" title="" Alt=""   border="0" >
				</a>';
				*/

				$file = fopen("count_file.txt", "w");
				fwrite($file, $n);
				fclose($file);
			}

			//-------------logger function--------------------//
			$v_file = fopen("visitor.txt", "a");

			$Users_IP_address = VisitorIP();

			$date = new DateTime("now", new DateTimeZone('Europe/Lisbon'));
			date_default_timezone_set('Europe/Lisbon');
			$today = date("j F, Y, H:i:s");
			$log = "Visitor number ".$n."\nDATA: ". $today."\n\t\t".$Users_IP_address;
			$log.="\n \n";

			fwrite($v_file, $log);
			fclose($v_file);

			function VisitorIP(){
   				if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
   					$TheIp=$_SERVER['HTTP_X_FORWARDED_FOR'];
    			else
    				$TheIp=$_SERVER['REMOTE_ADDR'];

    			$country = file_get_contents('http://api.hostip.info/get_html.php?ip='.$TheIp.'&position=true');
    			$country = $l = preg_replace("/\s+/", " ", $country);
    			$temp = "IP: ".$TheIp."\t".$country;
    			return trim($temp);
			}
			//------------------------------------------------//
			?>
			</div>

			<?php
			$file_handle = fopen("footer.txt", "r");

			while (!feof($file_handle)) {
   				$line = fgets($file_handle);
   				echo $line;
			}
				
			fclose($file_handle);
		?>



		</div>
	</div>
</body>
</html>
